package chapter06

/**
 * 特质叠加的钻石叠加问题
 * 叠加顺序是从最后面然后绕道前面  最本质的那个在最前面 从
 */
object Demo15_Traitzhausnhi {
    def main(array: Array[String]): Unit = {
      val ball1 = new MyFootBall1
      println(ball1.describe())
    }
}
trait Ball1{
  def describe(): String = "ball"
}

trait ColorBall1 extends Ball1 {
  var color: String = "red"
  override def describe(): String = color + "_" + super.describe()
}

trait CategoryBall1 extends Ball1{
  var category: String = "foot"
  override def describe(): String = category + "_" + super.describe()
}

class MyFootBall1 extends CategoryBall with ColorBall{
  //override def describe(): String = "My ball is a " + "_" + super.describe()
  //如果想要直接super里面就是想用那个父类的可以在super后面加[CategoryBall]直接指定
  override def describe(): String = "My ball is a "  + super[CategoryBall].describe()

}